define(['jquery','jquery.cookie'],function(){
	return {
		menuover:function(){//左菜单栏滑动事件
			$('.menu').children('li').hover(function(){
				$(this).children('a').css('background','#db366f');
			},function(){
				$(this).children('a').css('background','none');
			});
			$('.list').hover(function(){
				$(this).children('ul').stop(true,true).show(200);
				$(this).find('li').hover(function(){
					$(this).children('a').css('background','#db366f');
					$(this).parent().siblings('a').css('background','none');
				},function(){
					$(this).children('a').css('background','none');
				})
			},function(){
				$(this).children('ul').stop(true,true).hide(200);
			});
		},
		
		side:function(){//右菜单栏滑动事件，滚轮事件
			$('.side_04').on('click',function(){
				$('body,html').animate({
					scrollTop:0
				},200);
			});
			$(document).on('scroll',function(){
				if($(document).scrollTop()!=0){
					$('.side_04').stop().fadeIn(400)
				}else{
					$('.side_04').stop().fadeOut(400)
				}
			});
			$('.side_02').hover(function(){
				$('.kefu').stop().show(200);
			},function(){
				$('.kefu').stop().hide(200);
			})
		},
		
		searchover:function(){//搜索栏滑动事件
			$('.searchbox').hover(function(){
				$('.close').stop().fadeIn(400);
			},function(){
				$('.close').stop().fadeOut(400);
			});
			$('#searchbtn').hover(function(){
				$(this).css('background','#D00149');
			},function(){
				$(this).css('background','black');
			});
			$('.close').hover(function(){
				$(this).css('background','#d4d4d4').css('color','#b3b3b3');
			},function(){
				$(this).css('background','#524b49').css('color','#7f7978');
			});
			$('.close').on('click',function(){
				$('.searchbox').stop().animate({
					height:0
				},200,function(){
					$('.inquery').hide();
				});
			});
			$('.search').on('click',function(){
				$('.searchbox').stop().animate({
					height:85
				},200,function(){
					$('.inquery').show();
				});
			})
		},
		flhover:function(){//底部划过事件
			$('.fl a').hover(function(){
				$(this).css('color','#666666');
			},function(){
				$(this).css('color','#898989');
			})
		},
		/*ajax:function(){
			$.when($.ajax({url:'php/lunbo.php',dataType:'json'}),$.ajax({url:'php/midimg.php',dataType:'json'})).done(function(a1,a2){
				var html='';
				html+='<ul>';
					for(var i=0;i<a1.length;i++){
						html+='<li><a href="javascript:;"><img src="'+a1[i]['imgurl']+'"/></a></li>'
					}
				html+='</ul>';
				$('.banner').html(html);

				var midimg='';
				midimg='<ul><li><a href="javascript:;"><img src="'+a2[0]['imgurl']+'"/></a></li><li class="c-2 clear"><a href="javascript:;" class="decoration-l"><h2>秘密花园</h2><p class="text">低碳、环保；安全、有效。坚持汲取自然植物的力量，以绿色原料、环保包装来缔造健康肌肤为理念; 采用符合国际所认可的生产标准，创造安全...</p><p class="read">查看全文>></p><div class="img"><img src="img/index/1429135533360184232.jpg"/></div><span></span></a></li><li class="clear"><a href="javascript:;" class="decoration-r"><h2>看看男神好哪口</h2><p class="text">相信每一位女孩在心中都有一位梦中情人，ta可能是温柔的，又可能是霸道的；ta可能是热爱运动的，又可能是安静温文的。情人节来临之际，...</p><p class="read">查看全文>></p><div class="img"><img src="img/index/1429136322384888479.jpg"/></div><span></span></a></li></ul>';
				$('.t-left').html(midimg);
			})
		}*/
		ajax:function(){
			$.ajax({
				url:'php/lunbo.php',
				dataType:'json',
				async:false,
				beforeSend:function(){
					$('.banner').html('<img src="img/demoimg/loader.gif" class="loading">');				
				}
			}).done(function(a1){
				var html='';
				html+='<div class="leftbtn"></div><div class="rightbtn"></div><div class="bindex clear"><span class="bullet-first" style="background:#e1472f"></span><span class="bullet-select"></span><span class="bullet-last"></span></div>'
				html+='<ul>';
					for(var i=0;i<a1.length;i++){
						html+='<li><a href="javascript:;"><img src="'+a1[i]['imgurl']+'"/></a></li>'
					}
				html+='</ul>';
				$('.banner').html(html);
			});
			$.ajax({
				url:'php/midimg.php',
				dataType:'json',
				async:false,
				beforeSend:function(){
					$('.row').html('<img src="img/demoimg/loader.gif" class="loading">');
				}
			}).done(function(a2){
				var t_1='';
				var t_2='';
				var t_3='';
				var c_1='';
				var c_2='';
				var c_3='';
				var b_1='';
				var b_2='';
				var b_3='';
				t_1='<ul><li><a href="javascript:;"><img src="'+a2[0]['imgurl']+'"/></a></li><li class="c-2 clear"><a href="javascript:;" class="decoration-l"><h2>'+a2[0]['title']+'</h2><p class="text">'+a2[0]['decoration']+'</p><p class="read">'+a2[0]['read']+'</p><div class="img"><img src="'+a2[0]['smalimg']+'"/></div><span></span></a></li><li class="clear"><a href="javascript:;" class="decoration-r"><h2>'+a2[1]['title']+'</h2><p class="text" id="text">'+a2[1]['decoration']+'</p><p class="read">'+a2[0]['read']+'</p><div class="img"><img src="'+a2[1]['smalimg']+'"/></div><span></span></a></li></ul>';
				t_2='<ul><li><a href="javascript:;" class="decoration-l-p"><h2>'+a2[2]['title']+'</h2><p class="text">'+a2[2]['decoration']+'</p><p class="p-price">'+a2[2]['price']+'</p><div class="img"><img src="'+a2[2]['smalimg']+'"style="height:238px;width:200px"/></div><span></span></a></li><li class="big c-2"><a href="javascript:;"><img src="'+a2[2]['imgurl']+'"/></a></li></ul>';
				t_3='<div class="trshop"><div class="b1"><img src="img/index/1490296369700099015.jpg"/><div class="iclose">×</div></div><div class="b2 fl"><h3><a href="introduce.html">'+a2[3]['title']+'</a></h3><p><a href="introduce.html">'+a2[3]['decoration']+'</a></p></div><div class="b3 fl"><span>￥499</span><span class="toshop"></span><a href="introduce.html">查看详情>></a></div></div><ul><li class="bshop"><a href="javascript:;" class="decoration-l"><h2>'+a2[3]['title']+'</h2><p class="text">'+a2[3]['decoration']+'</p><div class="img"><img src="'+a2[3]['smalimg']+'"/></div><span></span></a></li><li class="c-2"><a href="javascript:;" class="decoration-r"><h2>'+a2[4]['title']+'</h2><p class="text">'+a2[4]['decoration']+'</p><p class="read">'+a2[4]['read']+'</p><div class="img"><img src="'+a2[4]['smalimg']+'"/></div><span></span></a></li><li><a href="javascript:;" class="decoration-l-p"><h2>'+a2[5]['title']+'</h2><p class="text">'+a2[5]['decoration']+'</p><p class="p-price">'+a2[5]['price']+'</p><div class="img"><img src="'+a2[5]['smalimg']+'"style="height:238px;width:200px"/></div><span></span></a></li></ul>';
				c_1='<ul><li class="clear"><a href="javascript:;" class="decoration-r"><h2>'+a2[6]['title']+'</h2><p class="text" id="text">'+a2[6]['decoration']+'</p><p class="read">'+a2[6]['price']+'</p><div class="img"><img src="'+a2[6]['smalimg']+'"/></div><span></span></a></li><li class="big c-2"><a href="javascript:;"><img src="'+a2[6]['imgurl']+'"/></a></li></ul>';
				c_2='<ul><li class="clear"><a href="javascript:;" class="decoration-l"><h2>'+a2[7]['title']+'</h2><p class="text">'+a2[7]['decoration']+'</p><p class="read">'+a2[7]['read']+'</p><div class="img"><img src="'+a2[7]['smalimg']+'"/></div><span></span></a></li><li class="c-2 clear"><a href="javascript:;" class="decoration-r"><h2>'+a2[8]['title']+'</h2><p class="text" id="text">'+a2[8]['decoration']+'</p><p class="read">'+a2[8]['read']+'</p><div class="img"><img src="'+a2[8]['smalimg']+'"/></div><span></span></a></li><li><a href="javascript:;" class="decoration-l"><h2>'+a2[9]['title']+'</h2><p class="text">'+a2[9]['decoration']+'</p><div class="img"><img src="'+a2[9]['smalimg']+'"/></div><span></span></a></li></ul>';
				c_3='<ul><li><a href="javascript:;"><img src="'+a2[10]['imgurl']+'"/></a></li><li class="c-2 clear"><a href="javascript:;" class="decoration-r"><h2>'+a2[10]['title']+'</h2><p class="text" id="text">'+a2[10]['decoration']+'</p><p class="read">'+a2[10]['read']+'</p><div class="img"><img src="'+a2[10]['smalimg']+'"/></div><span></span></a></li><li><a href="javascript:;" class="decoration-l"><h2>'+a2[11]['title']+'</h2><p class="text">'+a2[11]['decoration']+'</p><div class="img"><img src="'+a2[11]['smalimg']+'"/></div><span></span></a></li></ul>';
				b_1='<ul><li class="clear"><a href="javascript:;" class="decoration-l"><h2>'+a2[12]['title']+'</h2><p class="text">'+a2[12]['decoration']+'</p><p class="read">'+a2[12]['read']+'</p><div class="img"><img src="'+a2[12]['smalimg']+'"/></div><span></span></a></li><li class="c-2 clear"><a href="javascript:;" class="decoration-r"><h2>'+a2[13]['title']+'</h2><p class="text" id="text">'+a2[13]['decoration']+'</p><p class="read">'+a2[13]['read']+'</p><div class="img"><img src="'+a2[13]['smalimg']+'"/></div><span></span></a></li><li><a href="javascript:;" class="decoration-l"><h2>'+a2[14]['title']+'</h2><p class="text">'+a2[14]['decoration']+'</p><div class="img"><img src="'+a2[14]['smalimg']+'"/></div><span></span></a></li></ul>';
				b_2='<ul><li><a href="javascript:;"><img src="'+a2[15]['imgurl']+'"/></a></li><li class="c-2 clear"><a href="javascript:;" class="decoration-r"><h2>'+a2[15]['title']+'</h2><p class="text" id="text">'+a2[15]['decoration']+'</p><p class="read">'+a2[15]['read']+'</p><div class="img"><img src="'+a2[15]['smalimg']+'"/></div><span></span></a></li><li><a href="javascript:;" class="decoration-l"><h2>'+a2[16]['title']+'</h2><p class="text">'+a2[16]['decoration']+'</p><div class="img"><img src="'+a2[16]['smalimg']+'"/></div><span></span></a></li></ul>';
				b_3='<ul><li><a href="javascript:;" class="decoration-l"><h2>'+a2[17]['title']+'</h2><p class="text">'+a2[17]['decoration']+'</p><p class="p-price">'+a2[17]['price']+'</p><div class="img"><img src="'+a2[17]['smalimg']+'"style="height:238px;width:200px"/></div><span></span></a></li><li class="big c-2"><a href="javascript:;"><img src="'+a2[17]['imgurl']+'"/></a></li></ul>';
				$('.t-left').html(t_1);
				$('.t-center').html(t_2);
				$('.t-right,.b-right').html(t_3);
				$('.c-left').html(c_1);
				$('.c-center').html(c_2);
				$('.c-right').html(c_3);
				$('.b-left').html(b_1);
				$('.b-center').html(b_2);
				$('.b-right').html(b_3);
			})
		},
		cookie:function(){
			var uname=$.cookie('UserName');
			if(uname){
				$('.lg,.rg').hide();
				$('.lout').show();
				$('.admin').show().html('您好，'+uname);
			}
			$('.lout').on('click',function(){
				$('.lg,.rg').show();
				$('.lout').hide();
				$('.admin').hide().html('');
				$.cookie('UserName',null,{expires:-1});
			})
		},
		shopclick:function(){
			$('.bshop').on('click',function(){
				$('.hb').show();
				$('.trshop').show();
				$('.iclose').fadeIn();
				$('.trshop').stop(true,true).animate({
					width:400
				},400,function(){
					$('.trshop').stop(true,true).animate({
						height:724
					},400)
				})
			});
			$('.iclose').on('click',function(){
				$('.hb').hide();
				$('.iclose').fadeOut();
				$('.trshop').stop(true,true).animate({
					height:238
				},400,function(){
					$('.trshop').stop().animate({
						width:0
					},400,function(){
						$('.trshop').hide();
					})
				})
			});
		}
	}
})